//
//  MoreTableViewCell.m
//  specialine
//
//  Created by 往返网络 on 17/7/16.
//  Copyright © 2017年 com. All rights reserved.
//

#import "MoreTableViewCell.h"

@implementation MoreTableViewCell
{
    UILabel * tixianlab;
    UILabel * riqilab;
    UILabel * yuelab;
    UILabel * yuenum; //余额
    UILabel * tixiannum;//提现钱数

}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createUI];
    }
    return self;
}
- (void)createUI{
    
    float fontsize = 14;
    fontsize = SCREEN_H < 667 ? 12 : 16;
    if (SCREEN_H == 667) {
        fontsize = 14;
    }
    tixianlab = [[UILabel alloc]initWithFrame:CGRectMake(0, 11.0/H_BASE*SCREEN_H, 88.0/W_BASE*SCREEN_W, 38.0/H_BASE*SCREEN_H)];
    tixianlab.font = [UIFont systemFontOfSize:fontsize-1];
    [self.contentView addSubview:tixianlab];
    tixianlab.textColor = [UIColor blackColor];
//    tixianlab.backgroundColor = [UIColor yellowColor];
    tixianlab.textAlignment = NSTextAlignmentRight;

    riqilab = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_W-25.0/W_BASE*SCREEN_W-275.0/W_BASE*SCREEN_W, CGRectGetMinY(tixianlab.frame), 275.0/W_BASE*SCREEN_W, CGRectGetHeight(tixianlab.frame))];
    riqilab.textColor = [UIColor blackColor];
    riqilab.font = [UIFont systemFontOfSize:fontsize-1];
    [self.contentView addSubview:riqilab];
    riqilab.textAlignment = NSTextAlignmentRight;
//    riqilab.backgroundColor = [UIColor redColor];
    
    yuelab = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(tixianlab.frame), CGRectGetWidth(tixianlab.frame), CGRectGetHeight(tixianlab.frame))];
//    yuelab.text = @"余额:";
    yuelab.font = [UIFont systemFontOfSize:fontsize-2];
    yuelab.textColor = [UIColor blackColor];
    [self.contentView addSubview:yuelab];
    yuelab.textAlignment = NSTextAlignmentRight;
//    yuelab.backgroundColor = [UIColor greenColor];
    
    yuenum = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(yuelab.frame)+8.0/W_BASE*SCREEN_W, CGRectGetMinY(yuelab.frame), 220.0/W_BASE*SCREEN_W, CGRectGetHeight(yuelab.frame))];
    yuenum.textColor = [UIColor blackColor];
//    yuenum.text = @"2000";
    yuenum.font = [UIFont systemFontOfSize:fontsize - 1];
    [self.contentView addSubview:yuenum];
//    yuenum.backgroundColor = [UIColor purpleColor];
    
    tixiannum = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_W-25.0/W_BASE*SCREEN_W-275.0/W_BASE*SCREEN_W, CGRectGetMaxY(riqilab.frame), 275.0/W_BASE*SCREEN_W, CGRectGetHeight(yuenum.frame))];
//    tixiannum.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:tixiannum];
    tixiannum.font = [UIFont boldSystemFontOfSize:fontsize-1];
    tixiannum.textAlignment = NSTextAlignmentRight;
    
    UIView * breakview = [[UIView alloc]initWithFrame:CGRectMake(0, 106.0/H_BASE*SCREEN_H, SCREEN_W, 1)];
    breakview.backgroundColor = COLORRGBA(239, 239, 239, 1);
    [self.contentView addSubview:breakview];
    
}

- (void)refreshCellWithDic:(NSDictionary *)dic{
    NSString * operate_type = dic[@"operate_type"];
    //操作类型 1、充值 2、提现 3、转账
    if ([operate_type isEqualToString:@"1"]) {
        tixianlab.text = @"充值";
    }else if ([operate_type isEqualToString:@"2"]){
        tixianlab.text = @"提现";
    }else if ([operate_type isEqualToString:@"3"]){
        tixianlab.text = @"转账";
    }
//    NSString * time = dic[@"time"];
//    if ([dic[@"time"]isKindOfClass:[NSNull class]]) {
//        riqilab.text = @"";
//    }
//    NSLog(@"time is %@,length %ld",dic[@"time"],time.length);
    riqilab.text = [NSString stringWithFormat:@"%@",dic[@"time"]];
    tixiannum.text = [NSString stringWithFormat:@"%@",dic[@"money"]];

}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
